package top.v5it.japi.plus.data.support.entity;

import lombok.Data;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 基础类，用于审计
 *
 * @author zhanpu
 */
@Data
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public class BaseEntity implements Serializable {

    private static final long serialVersionUID = 6487211074290997419L;

    /**
     * 创建人
     */
    @CreatedBy
    private String createdBy;

    /**
     * 修改人
     */
    @LastModifiedBy
    private String updatedBy;
    /**
     * 创建时间
     */
    @CreatedDate
    private LocalDateTime createdTime;

    /**
     * 修改时间
     */
    @LastModifiedDate
    private LocalDateTime updatedTime;

    /**
     * 删除标识 0-删除；1-正常；
     */
    private Integer delFlag;
}
